﻿using System.Data.Entity;

namespace HobSoft.SoccerBet2014.Domain.Models.DbContext
{
    using DbSchema;
    public class BetDbContext : System.Data.Entity.DbContext
    {
        public BetDbContext()
            : base("BetDbContext")
        {
            this.Configuration.LazyLoadingEnabled = false;
        }

        public BetDbContext(string connStringName)
            : base(connStringName)
        {

        }

        public IDbSet<Bookmaker> BookerSet { get; set; }
        public IDbSet<BmAccount> AccountSet { get; set; }
        public IDbSet<Tournament> TournamentSet { get; set; }
        public IDbSet<Game> GameSet { get; set; }
        public IDbSet<Market> MarketSet { get; set; }
        public IDbSet<Odds> OddsSet { get; set; }
        public IDbSet<OddsPrice> OddsPriceSet { get; set; }
        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Conventions.Remove<System.Data.Entity.Infrastructure.IncludeMetadataConvention>();
            base.OnModelCreating(modelBuilder);
            modelBuilder.Configurations.Add(new BookmakerConfiguration());
            modelBuilder.Configurations.Add(new BmAccountConfiguration());
            modelBuilder.Configurations.Add(new TournamentConfiguration());
            modelBuilder.Configurations.Add(new GameConfiguration());
            modelBuilder.Configurations.Add(new MarketConfiguration());
            modelBuilder.Configurations.Add(new OddsConfiguration());
            modelBuilder.Configurations.Add(new OddsPriceConfiguration());
        }
    }
}
